package com.eastfair.pay.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 交易记录
 * </p>
 *
 * @author clm
 * @since 2023-02-21
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("pay_transaction")
@ApiModel(value = "Transaction", description = "交易记录")
@AllArgsConstructor
public class Transaction extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 单号
     */
    @ApiModelProperty(value = "单号")
    @Size(max = 255, message = "单号长度不能超过255")
    @TableField(value = "transaction_num", condition = LIKE)
    @Excel(name = "单号")
    private String transactionNum;

    /**
     * 展会名称
     */
    @ApiModelProperty(value = "展会名称")
    @Size(max = 255, message = "展会名称长度不能超过255")
    @TableField(value = "exhibition_name", condition = LIKE)
    @Excel(name = "展会名称")
    private String exhibitionName;

    /**
     * 展会id
     */
    @ApiModelProperty(value = "展会id")
    @TableField(value = "exhibition_id")
    @Excel(name = "展会id")
    private Long exhibitionId;

    /**
     * 展厅
     */
    @ApiModelProperty(value = "展厅")
    @Size(max = 255, message = "展厅长度不能超过255")
    @TableField(value = "space_name", condition = LIKE)
    @Excel(name = "展厅")
    private String spaceName;

    /**
     * 展位
     */
    @ApiModelProperty(value = "展位")
    @Size(max = 255, message = "展位长度不能超过255")
    @TableField(value = "site_name", condition = LIKE)
    @Excel(name = "展位")
    private String siteName;

    /**
     * 服务商类型
     */
    @ApiModelProperty(value = "服务商类型")
    @Size(max = 255, message = "服务商类型长度不能超过255")
    @TableField(value = "service_provider_type", condition = LIKE)
    @Excel(name = "服务商类型")
    private String serviceProviderType;

    /**
     * 服务商名称
     */
    @ApiModelProperty(value = "服务商名称")
    @Size(max = 255, message = "服务商名称长度不能超过255")
    @TableField(value = "service_provider_name", condition = LIKE)
    @Excel(name = "服务商名称")
    private String serviceProviderName;

    /**
     * 服务商id
     */
    @ApiModelProperty(value = "服务商id")
    @TableField(value = "service_provider_id")
    @Excel(name = "服务商id")
    private Long serviceProviderId;

    /**
     * 业务类型(订单，结算单)
     */
    @ApiModelProperty(value = "业务类型(订单，结算单)")
    @Size(max = 255, message = "业务类型(订单，结算单)长度不能超过255")
    @TableField(value = "order_type", condition = LIKE)
    @Excel(name = "业务类型(订单，结算单)")
    private String orderType;

    /**
     * 单号
     */
    @ApiModelProperty(value = "单号")
    @Size(max = 255, message = "单号长度不能超过255")
    @TableField(value = "order_num", condition = LIKE)
    @Excel(name = "单号")
    private String orderNum;

    /**
     * 单额
     */
    @ApiModelProperty(value = "单额")
    @TableField(value = "order_amount")
    @Excel(name = "单额")
    private BigDecimal orderAmount;

    /**
     * 订单时间
     */
    @ApiModelProperty(value = "订单时间")
    @TableField(value = "order_time")
    @Excel(name = "订单时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime orderTime;

    /**
     * 交易类型(付款，退款)
     */
    @ApiModelProperty(value = "交易类型(付款，退款)")
    @Size(max = 255, message = "交易类型(付款，退款)长度不能超过255")
    @TableField(value = "transaction_type", condition = LIKE)
    @Excel(name = "交易类型(付款，退款)")
    private String transactionType;

    /**
     * 付款方
     */
    @ApiModelProperty(value = "付款方")
    @Size(max = 255, message = "付款方长度不能超过255")
    @TableField(value = "payer", condition = LIKE)
    @Excel(name = "付款方")
    private String payer;

    /**
     * 付款方式
     */
    @ApiModelProperty(value = "付款方式")
    @Size(max = 255, message = "付款方式长度不能超过255")
    @TableField(value = "pay_type", condition = LIKE)
    @Excel(name = "付款方式")
    private String payType;

    /**
     * 交易状态
     */
    @ApiModelProperty(value = "交易状态")
    @Size(max = 255, message = "交易状态长度不能超过255")
    @TableField(value = "transaction_state", condition = LIKE)
    @Excel(name = "交易状态")
    private String transactionState;

    /**
     * 系统标识
     */
    @ApiModelProperty(value = "系统标识")
    @Size(max = 255, message = "系统标识长度不能超过255")
    @TableField(value = "system_scene", condition = LIKE)
    @Excel(name = "系统标识")
    private String systemScene;

    /**
     * 收款单位
     */
    @ApiModelProperty(value = "收款单位")
    @Size(max = 255, message = "收款单位长度不能超过255")
    @TableField(value = "payee", condition = LIKE)
    @Excel(name = "收款单位")
    private String payee;

    /**
     * 收款单位主键
     */
    @ApiModelProperty(value = "收款单位主键")
    @TableField(value = "payee_id")
    @Excel(name = "收款单位主键")
    private Long payeeId;

    /**
     * 订单状态
     */
    @ApiModelProperty(value = "订单状态")
    @Size(max = 255, message = "订单状态长度不能超过255")
    @TableField(value = "order_status", condition = LIKE)
    @Excel(name = "订单状态")
    private String orderStatus;

    /**
     * 交易金额
     */
    @ApiModelProperty(value = "交易金额")
    @TableField(value = "transtion_amount")
    @Excel(name = "交易金额")
    private BigDecimal transtionAmount;

    /**
     * 交易时间
     */
    @ApiModelProperty(value = "交易时间")
    @TableField(value = "transtion_time")
    @Excel(name = "交易时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime transtionTime;

    /**
     * 流水号
     */
    @ApiModelProperty(value = "流水号")
    @Size(max = 255, message = "流水号长度不能超过255")
    @TableField(value = "serial_number", condition = LIKE)
    @Excel(name = "流水号")
    private String serialNumber;

    /**
     * 支付渠道
     */
    @ApiModelProperty(value = "支付渠道")
    @Size(max = 255, message = "支付渠道长度不能超过255")
    @TableField(value = "payment_channel", condition = LIKE)
    @Excel(name = "支付渠道")
    private String paymentChannel;

    /**
     * 制单状态
     */
    @ApiModelProperty(value = "制单状态")
    @Size(max = 255, message = "制单状态长度不能超过255")
    @TableField(value = "voucher_status", condition = LIKE)
    @Excel(name = "制单状态")
    private String voucherStatus;

    /**
     * 制单流水号
     */
    @ApiModelProperty(value = "制单流水号")
    @TableField(value = "voucher_serial_number")
    @Excel(name = "制单流水号")
    private String voucherSerialNumber;


    @Builder
    public Transaction(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime,
                       Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId,
                       String transactionNum, String exhibitionName, Long exhibitionId, String spaceName, String siteName, String serviceProviderType,
                       String serviceProviderName, Long serviceProviderId, String orderType, String orderNum, BigDecimal orderAmount, LocalDateTime orderTime,
                       String transactionType, String payer, String payType, String transactionState, String systemScene, String payee,
                       Long payeeId, String orderStatus, BigDecimal transtionAmount, LocalDateTime transtionTime, String serialNumber, String paymentChannel,
                       String voucherStatus, String voucherSerialNumber) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.transactionNum = transactionNum;
        this.exhibitionName = exhibitionName;
        this.exhibitionId = exhibitionId;
        this.spaceName = spaceName;
        this.siteName = siteName;
        this.serviceProviderType = serviceProviderType;
        this.serviceProviderName = serviceProviderName;
        this.serviceProviderId = serviceProviderId;
        this.orderType = orderType;
        this.orderNum = orderNum;
        this.orderAmount = orderAmount;
        this.orderTime = orderTime;
        this.transactionType = transactionType;
        this.payer = payer;
        this.payType = payType;
        this.transactionState = transactionState;
        this.systemScene = systemScene;
        this.payee = payee;
        this.payeeId = payeeId;
        this.orderStatus = orderStatus;
        this.transtionAmount = transtionAmount;
        this.transtionTime = transtionTime;
        this.serialNumber = serialNumber;
        this.paymentChannel = paymentChannel;
        this.voucherStatus = voucherStatus;
        this.voucherSerialNumber = voucherSerialNumber;
    }

}
